<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var arr="aabccd"
    var str=arr.split("")
    var res =str.reduce(function(pre,cur){
        if(pre.indexOf(cur)===-1){
            return pre.concat(cur)
        }else{
            return pre
        }
    },[])
    console.log(res);
    // console.log(str);
    var arr2=res.join("")
    console.log(arr2);
    
</script>